get common values from two arrays javascript

117

get common values from two arrays javascript -

let intersection = arrA.filter(x => arrB.includes(x));

javascript get same elments from multiple arrays -

var result = arrays.shift().filter(function(v) {
    return arrays.every(function(a) {
        return a.indexOf(v) !== -1;
    });
});

Comments

Submit
0 Comments